package cn.lsc.feignclientfactory;

import cn.lsc.domain.User;
import cn.lsc.feignclient.UserFeignClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeignClient> {


    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public User findById(Long id) {
                return new User(-1L,"触发熔断了喔！","服务不可用!");
            }
        };
    }
}
